package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.entity.Inventory;
import com.project.vo.InventoryDetailVO;
import com.project.vo.InventoryListVO;
import com.project.vo.InventoryStatisticsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


@Mapper
public interface InventoryMapper extends BaseMapper<Inventory> {
    /**
     * 获取库存列表
     */
    Page<InventoryListVO> queryPage(@Param("page") Page<InventoryListVO> page);

    /**
     * 根据材料ID查询库存信息
     */
    InventoryDetailVO queryMaterialDetailById(Integer materialId);

    /**
     * 根据库存ID查询库存信息
     */
    @Select("select * from inventory where inventory_id = #{inventoryId}")
    InventoryDetailVO queryInventoryById(Integer inventoryId);

    /**
     * 修改库存数量
     */
    void updateById(Integer inventoryId, Inventory inventory);

    /**
     * 获取库存统计信息
     */
    InventoryStatisticsVO getInventoryStatistics(Integer categoryId);

    /**
     * 新增库存信息
     */
    int addInventory(Inventory inventory);
}